home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / rainbow.c < prev    next >
C/C++ Source or Header  |  2000-05-25  |  24KB  |  687 lines

  1. /***************************************************************************
  2.   Rainbow Islands (and Jumping)
  3.  
  4.   driver by Mike Coates
  5.  
  6. ***************************************************************************/
  7.  
  8. #include "driver.h"
  9. #include "vidhrdw/generic.h"
  10. #include "cpu/z80/z80.h"
  11.  
  12. /***************************************************************************
  13.   Video Hardware - Uses similar engine to Rastan
  14. ***************************************************************************/
  15.  
  16. extern size_t rastan_videoram_size;
  17.  
  18. extern unsigned char *rastan_ram;
  19. extern unsigned char *rastan_videoram1,*rastan_videoram3;
  20. extern unsigned char *rastan_spriteram;
  21. extern unsigned char *rastan_scrollx;
  22. extern unsigned char *rastan_scrolly;
  23.  
  24. WRITE_HANDLER( rastan_spriteram_w );
  25. READ_HANDLER( rastan_spriteram_r );
  26. WRITE_HANDLER( rastan_videoram1_w );
  27. READ_HANDLER( rastan_videoram1_r );
  28. WRITE_HANDLER( rastan_videoram3_w );
  29. READ_HANDLER( rastan_videoram3_r );
  30.  
  31. int  rastan_vh_start(void);
  32. void rastan_vh_stop(void);
  33.  
  34. WRITE_HANDLER( rastan_scrollY_w );
  35. WRITE_HANDLER( rastan_scrollX_w );
  36. WRITE_HANDLER( rastan_videocontrol_w );
  37. WRITE_HANDLER( rastan_flipscreen_w );
  38.  
  39. int  rastan_s_interrupt(void);
  40. READ_HANDLER( rastan_sound_r );
  41. WRITE_HANDLER( rastan_sound_port_w );
  42. WRITE_HANDLER( rastan_sound_comm_w );
  43.  
  44.  
  45. /***************************************************************************
  46.   Sound Hardware
  47.  
  48.   Rainbow uses a YM2151 and YM2103
  49.   Jumping uses two YM2203's
  50. ***************************************************************************/
  51.  
  52. void rastan_irq_handler(int irq);
  53.  
  54. READ_HANDLER( rastan_a001_r );
  55. WRITE_HANDLER( rastan_a000_w );
  56. WRITE_HANDLER( rastan_a001_w );
  57.  
  58. static struct MemoryReadAddress rastan_s_readmem[] =
  59. {
  60.     { 0x0000, 0x3fff, MRA_ROM },
  61.     { 0x4000, 0x7fff, MRA_BANK5 },
  62.     { 0x8000, 0x8fff, MRA_RAM },
  63.     { 0x9001, 0x9001, YM2151_status_port_0_r },
  64.     { 0x9002, 0x9100, MRA_RAM },
  65.     { 0xa001, 0xa001, rastan_a001_r },
  66.     { -1 }  /* end of table */
  67. };
  68.  
  69. static struct MemoryWriteAddress rastan_s_writemem[] =
  70. {
  71.     { 0x0000, 0x7fff, MWA_ROM },
  72.     { 0x8000, 0x8fff, MWA_RAM },
  73.     { 0x9000, 0x9000, YM2151_register_port_0_w },
  74.     { 0x9001, 0x9001, YM2151_data_port_0_w },
  75.     { 0xa000, 0xa000, rastan_a000_w },
  76.     { 0xa001, 0xa001, rastan_a001_w },
  77.     { -1 }  /* end of table */
  78. };
  79.  
  80.  
  81. static WRITE_HANDLER( rastan_bankswitch_w )
  82. {
  83.     unsigned char *RAM = memory_region(REGION_CPU2);
  84.     int banknum = ( data - 1 ) & 3;
  85.     cpu_setbank( 5, &RAM[ 0x10000 + ( banknum * 0x4000 ) ] );
  86. }
  87.  
  88. static struct YM2151interface ym2151_interface =
  89. {
  90.     1,            /* 1 chip */
  91.     4000000,    /* 4 MHz ? */
  92.     { YM3012_VOL(50,MIXER_PAN_LEFT,50,MIXER_PAN_RIGHT) },
  93.     { rastan_irq_handler },
  94.     { rastan_bankswitch_w }
  95. };
  96.  
  97. /***************************************************************************
  98.   Rainbow Islands Specific
  99. ***************************************************************************/
  100.  
  101. int  rainbow_interrupt(void);
  102. WRITE_HANDLER( rainbow_c_chip_w );
  103. READ_HANDLER( rainbow_c_chip_r );
  104. void rainbow_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  105.  
  106.  
  107. static WRITE_HANDLER( rainbow_sound_w )
  108. {
  109.     if (offset == 0)
  110.     {
  111.         rastan_sound_port_w(0,data & 0xff);
  112.     }
  113.     else if (offset == 2)
  114.     {
  115.         rastan_sound_comm_w(0,data & 0xff);
  116.     }
  117. }
  118.  
  119. static struct MemoryReadAddress rainbow_readmem[] =
  120. {
  121.     { 0x000000, 0x07ffff, MRA_ROM },
  122.     { 0x10c000, 0x10ffff, MRA_BANK1 },    /* RAM */
  123.     { 0x200000, 0x20ffff, paletteram_word_r },
  124.     { 0x390000, 0x390003, input_port_0_r },
  125.     { 0x3B0000, 0x3B0003, input_port_1_r },
  126.     { 0x3e0000, 0x3e0003, rastan_sound_r },
  127.     { 0x800000, 0x80ffff, rainbow_c_chip_r },
  128.     { 0xc00000, 0xc03fff, rastan_videoram1_r },
  129.     { 0xc04000, 0xc07fff, MRA_BANK2 },
  130.     { 0xc08000, 0xc0bfff, rastan_videoram3_r },
  131.     { 0xc0c000, 0xc0ffff, MRA_BANK3 },
  132.     { 0xd00000, 0xd0ffff, MRA_BANK4 },
  133.     { -1 }  /* end of table */
  134. };
  135.  
  136. static struct MemoryWriteAddress rainbow_writemem[] =
  137. {
  138.     { 0x000000, 0x07ffff, MWA_ROM },
  139.     { 0x10c000, 0x10ffff, MWA_BANK1 },
  140.     { 0x200000, 0x20ffff, paletteram_xBBBBBGGGGGRRRRR_word_w, &paletteram },
  141.     { 0x800000, 0x80ffff, rainbow_c_chip_w },
  142.     { 0xc00000, 0xc03fff, rastan_videoram1_w, &rastan_videoram1, &rastan_videoram_size },
  143.     { 0xc04000, 0xc07fff, MWA_BANK2 },
  144.     { 0xc08000, 0xc0bfff, rastan_videoram3_w, &rastan_videoram3 },
  145.     { 0xc0c000, 0xc0ffff, MWA_BANK3 },
  146.     { 0xc20000, 0xc20003, rastan_scrollY_w, &rastan_scrolly },  /* scroll Y  1st.w plane1  2nd.w plane2 */
  147.     { 0xc40000, 0xc40003, rastan_scrollX_w, &rastan_scrollx },  /* scroll X  1st.w plane1  2nd.w plane2 */
  148.     { 0xc50000, 0xc50003, rastan_flipscreen_w }, /* bit 0  flipscreen */
  149.     { 0xd00000, 0xd0ffff, MWA_BANK4, &rastan_spriteram },
  150.     { 0x3e0000, 0x3e0003, rainbow_sound_w },
  151.     { 0x3a0000, 0x3a0003, MWA_NOP },
  152.     { 0x3c0000, 0x3c0003, MWA_NOP },
  153.     { -1 }  /* end of table */
  154. };
  155.  
  156. INPUT_PORTS_START( rainbow )
  157.     PORT_START    /* DIP SWITCH A */
  158.     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
  159.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  160.     PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
  161.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) )
  162.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  163.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  164.     PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
  165.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
  166.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  167.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  168.     PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) )
  169.     PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) )
  170.     PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) )
  171.     PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) )
  172.     PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )
  173.     PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) )
  174.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_2C ) )
  175.     PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) )
  176.     PORT_DIPSETTING(    0x40, DEF_STR( 1C_4C ) )
  177.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_6C ) )
  178.  
  179.     PORT_START    /* DIP SWITCH B */
  180.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
  181.     PORT_DIPSETTING(    0x02, "Easy" )
  182.     PORT_DIPSETTING(    0x03, "Medium" )
  183.     PORT_DIPSETTING(    0x01, "Hard" )
  184.     PORT_DIPSETTING(    0x00, "Hardest" )
  185.     PORT_DIPNAME( 0x04, 0x04, DEF_STR( Bonus_Life ) )
  186.     PORT_DIPSETTING(    0x00, "None" )
  187.     PORT_DIPSETTING(    0x04, "100k,1000k" )
  188.     PORT_DIPNAME( 0x08, 0x08, "Complete Bonus" )
  189.     PORT_DIPSETTING(    0x00, "100K Points" )
  190.     PORT_DIPSETTING(    0x08, "1 Up" )
  191.     PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
  192.     PORT_DIPSETTING(    0x10, "1" )
  193.     PORT_DIPSETTING(    0x00, "2" )
  194.     PORT_DIPSETTING(    0x30, "3" )
  195.     PORT_DIPSETTING(    0x20, "4" )
  196.     PORT_DIPNAME( 0x40, 0x00, "Language" )
  197.     PORT_DIPSETTING(    0x00, "English" )
  198.     PORT_DIPSETTING(    0x40, "Japanese" )
  199.     PORT_DIPNAME( 0x80, 0x00, "Coin Type" )
  200.     PORT_DIPSETTING(    0x00, "Type 1" )
  201.     PORT_DIPSETTING(    0x80, "Type 2" )
  202.  
  203.     PORT_START    /* 800007 */
  204.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
  205.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
  206.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE )
  207.  
  208.     PORT_START /* 800009 */
  209.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
  210.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
  211.  
  212.     PORT_START    /* 80000B */
  213.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_TILT )
  214.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
  215.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
  216.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY )
  217.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY )
  218.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 )
  219.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 )
  220.  
  221.     PORT_START    /* 80000d */
  222.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
  223.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
  224.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY | IPF_PLAYER2 )
  225.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY | IPF_PLAYER2 )
  226.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  227.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  228.  
  229.     PORT_START    /* IN2 */
  230.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 )
  231.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
  232.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_TILT )
  233.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  234. INPUT_PORTS_END
  235.  
  236. static struct GfxLayout spritelayout1 =
  237. {
  238.     8,8,    /* 8*8 sprites */
  239.     16384,    /* 16384 sprites */
  240.     4,        /* 4 bits per pixel */
  241.     { 0, 1, 2, 3 },
  242.     { 8, 12, 0, 4, 24, 28, 16, 20 },
  243.     { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
  244.     32*8    /* every sprite takes 32 consecutive bytes */
  245. };
  246.  
  247. static struct GfxLayout spritelayout2 =
  248. {
  249.     16,16,    /* 16*16 sprites */
  250.     4096,    /* 1024 sprites */
  251.     4,        /* 4 bits per pixel */
  252.     { 0, 1, 2, 3 },
  253.     { 8, 12, 0, 4, 24, 28, 16, 20, 40, 44, 32, 36, 56, 60, 48, 52 },
  254.     { 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64,
  255.             8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 },
  256.     128*8    /* every sprite takes 128 consecutive bytes */
  257. };
  258.  
  259. static struct GfxLayout spritelayout3 =
  260. {
  261.     16,16,    /* 16*16 sprites */
  262.     1024,    /* 1024 sprites */
  263.     4,        /* 4 bits per pixel */
  264.     { 0, 1, 2, 3 },
  265.     {
  266.     0, 4, 0x10000*8+0 ,0x10000*8+4,
  267.     8+0, 8+4, 0x10000*8+8+0, 0x10000*8+8+4,
  268.     16+0, 16+4, 0x10000*8+16+0, 0x10000*8+16+4,
  269.     24+0, 24+4, 0x10000*8+24+0, 0x10000*8+24+4
  270.     },
  271.     { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32,
  272.             8*32, 9*32, 10*32, 11*32, 12*32, 13*32, 14*32, 15*32 },
  273.     64*8    /* every sprite takes 64 consecutive bytes */
  274. };
  275.  
  276. static struct GfxDecodeInfo rainbowe_gfxdecodeinfo[] =
  277. {
  278.     { REGION_GFX1, 0x000000, &spritelayout1, 0, 0x80 },    /* sprites 8x8 */
  279.     { REGION_GFX2, 0x000000, &spritelayout2, 0, 0x80 },    /* sprites 16x16 */
  280.     { REGION_GFX2, 0x080000, &spritelayout3, 0, 0x80 },    /* sprites 16x16 */
  281.     { -1 }                                         /* end of array */
  282. };
  283.  
  284. static struct MachineDriver machine_driver_rainbow =
  285. {
  286.     /* basic machine hardware */
  287.     {
  288.         {
  289.             CPU_M68000,
  290.             8000000,    /* 8 Mhz */
  291.             rainbow_readmem,rainbow_writemem,0,0,
  292.             rainbow_interrupt,1
  293.         },
  294.         {
  295.             CPU_Z80,
  296.             4000000,    /* 4 Mhz */
  297.             rastan_s_readmem,rastan_s_writemem,0,0,
  298.             ignore_interrupt,1
  299.         }
  300.     },
  301.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  302.     10,    /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
  303.     0,
  304.  
  305.     /* video hardware */
  306.     40*8, 32*8, { 0*8, 40*8-1, 1*8, 31*8-1 },
  307.     rainbowe_gfxdecodeinfo,
  308.     2048, 2048,
  309.     0,
  310.  
  311.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
  312.     0,
  313.     rastan_vh_start,
  314.     rastan_vh_stop,
  315.     rainbow_vh_screenrefresh,
  316.  
  317.     /* sound hardware */
  318.     SOUND_SUPPORTS_STEREO,0,0,0,
  319.     {
  320.         {
  321.               SOUND_YM2151,
  322.             &ym2151_interface
  323.         },
  324.     }
  325. };
  326.  
  327.  
  328. /***************************************************************************
  329.   Jumping Specific
  330. ***************************************************************************/
  331.  
  332. void jumping_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  333. static int jumping_latch = 0;
  334.  
  335. static WRITE_HANDLER( jumping_sound_w )
  336. {
  337.     if (offset == 0)
  338.     {
  339.         jumping_latch = data & 0xff; /*M68000 writes .b to $400007*/
  340.         /*logerror("jumping M68k write latch=%02x\n",jumping_latch);*/
  341.         cpu_cause_interrupt(1,Z80_IRQ_INT);
  342.     }
  343. }
  344.  
  345. static READ_HANDLER( jumping_latch_r )
  346. {
  347.     /*logerror("jumping Z80 reads latch=%02x\n",jumping_latch);*/
  348.     return jumping_latch;
  349. }
  350.  
  351. static struct MemoryReadAddress jumping_readmem[] =
  352. {
  353.     { 0x000000, 0x08ffff, MRA_ROM },
  354.     { 0x10c000, 0x10ffff, MRA_BANK1 },        /* RAM */
  355.     { 0x200000, 0x20ffff, paletteram_word_r },
  356.     { 0x400000, 0x400001, input_port_0_r },
  357.     { 0x400002, 0x400003, input_port_1_r },
  358.     { 0x401000, 0x401001, input_port_2_r },
  359.     { 0x401002, 0x401003, input_port_3_r },
  360.     { 0xc00000, 0xc03fff, rastan_videoram1_r },
  361.     { 0xc04000, 0xc07fff, MRA_BANK2 },
  362.     { 0xc08000, 0xc0bfff, rastan_videoram3_r },
  363.     { 0xc0c000, 0xc0ffff, MRA_BANK3 },
  364.     { 0x440000, 0x4407ff, MRA_BANK4 },
  365.     { 0xd00000, 0xd01fff, MRA_BANK5 },         /* Needed for Attract Mode */
  366.     { 0x420000, 0x420001, MRA_NOP},            /* Read, but result not used */
  367.     { -1 }  /* end of table */
  368. };
  369.  
  370. static struct MemoryWriteAddress jumping_writemem[] =
  371. {
  372.     { 0x000000, 0x08ffff, MWA_ROM },
  373.     { 0x10c000, 0x10ffff, MWA_BANK1 },
  374.     { 0x200000, 0x20ffff, paletteram_xxxxBBBBGGGGRRRR_word_w , &paletteram },
  375.     { 0xc00000, 0xc03fff, rastan_videoram1_w, &rastan_videoram1, &rastan_videoram_size },
  376.     { 0xc04000, 0xc07fff, MWA_BANK2 },
  377.     { 0xc08000, 0xc0bfff, rastan_videoram3_w, &rastan_videoram3 },
  378.     { 0xc0c000, 0xc0ffff, MWA_BANK3 },
  379.     { 0x430000, 0x430003, rastan_scrollY_w, &rastan_scrolly }, /* scroll Y  1st.w plane1  2nd.w plane2 */
  380.     { 0xc20000, 0xc20003, MWA_NOP },            /*seems it is a leftover from rainbow, games writes scroll y here, too */
  381.        { 0xc40000, 0xc40003, rastan_scrollX_w, &rastan_scrollx }, /* scroll X  1st.w plane1  2nd.w plane2 */
  382.     { 0x440000, 0x4407ff, MWA_BANK4, &rastan_spriteram },
  383.     { 0x400006, 0x400007, jumping_sound_w },
  384.     { 0xd00000, 0xd01fff, MWA_BANK5 },             /* Needed for Attract Mode */
  385.     { 0x3c0000, 0x3c0001, MWA_NOP },            /* Watchdog ? */
  386.     { 0x800000, 0x80ffff, MWA_NOP },            /* Original C-Chip location (not used) */
  387.     { -1 }  /* end of table */
  388. };
  389.  
  390. #if 0
  391. static WRITE_HANDLER( jumping_bankswitch_w )
  392. {
  393.     unsigned char *RAM = memory_region(REGION_CPU2);
  394.     int banknum = (data & 1);
  395.     /*if (!(data & 8)) logerror("bankswitch not ORed with 8 !!!\n");*/
  396.  
  397.     /*if (banknum != 1) logerror("bank selected =%02x\n", banknum);*/
  398.     cpu_setbank( 6, &RAM[ 0x10000 + ( banknum * 0x2000 ) ] );
  399. }
  400. #endif
  401.  
  402. static struct MemoryReadAddress jumping_sound_readmem[] =
  403. {
  404.     { 0x0000, 0x7fff, MRA_ROM },
  405. /*{ ????, ????, MRA_BANK6 },*/
  406.     { 0x8000, 0x8fff, MRA_RAM },
  407.     { 0xb000, 0xb000, YM2203_status_port_0_r },
  408.     { 0xb400, 0xb400, YM2203_status_port_1_r },
  409.     { 0xb800, 0xb800, jumping_latch_r },
  410.     { 0xc000, 0xffff, MRA_ROM },
  411.     { -1 }  /* end of table */
  412. };
  413.  
  414. static struct MemoryWriteAddress jumping_sound_writemem[] =
  415. {
  416.     { 0x0000, 0x7fff, MWA_ROM },
  417.     { 0x8000, 0x8fff, MWA_RAM },
  418.     { 0xb000, 0xb000, YM2203_control_port_0_w },
  419.     { 0xb001, 0xb001, YM2203_write_port_0_w },
  420.     { 0xb400, 0xb400, YM2203_control_port_1_w },
  421.     { 0xb401, 0xb401, YM2203_write_port_1_w },
  422.     { 0xbc00, 0xbc00, MWA_NOP },
  423. /*{ 0xbc00, 0xbc00, jumping_bankswitch_w },*/ /*looks like a bankswitch, but sound works with or without it*/
  424.     { -1 }  /* end of table */
  425. };
  426.  
  427. INPUT_PORTS_START( jumping )
  428.  
  429.     PORT_START    /* DIP SWITCH A */
  430.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
  431.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  432.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  433.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
  434.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  435.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  436.     PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
  437.     PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
  438.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  439.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
  440.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  441.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  442.     PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) )
  443.     PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) )
  444.     PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) )
  445.     PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) )
  446.     PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )
  447.     PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) )
  448.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_2C ) )
  449.     PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) )
  450.     PORT_DIPSETTING(    0x40, DEF_STR( 1C_4C ) )
  451.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_6C ) )
  452.  
  453.     PORT_START    /* DIP SWITCH B */
  454.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
  455.     PORT_DIPSETTING(    0x02, "Easy" )
  456.     PORT_DIPSETTING(    0x03, "Medium" )
  457.     PORT_DIPSETTING(    0x01, "Hard" )
  458.     PORT_DIPSETTING(    0x00, "Hardest" )
  459.     PORT_DIPNAME( 0x04, 0x00, DEF_STR( Bonus_Life ) )
  460.     PORT_DIPSETTING(    0x04, "100k,1000k" )
  461.     PORT_DIPSETTING(    0x00, "None" )
  462.     PORT_DIPNAME( 0x08, 0x00, "Complete Bonus" )
  463.     PORT_DIPSETTING(    0x08, "1 Up" )
  464.     PORT_DIPSETTING(    0x00, "None" )
  465.     PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
  466.     PORT_DIPSETTING(    0x10, "1" )
  467.     PORT_DIPSETTING(    0x00, "2" )
  468.     PORT_DIPSETTING(    0x30, "3" )
  469.     PORT_DIPSETTING(    0x20, "4" )
  470.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
  471.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  472.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  473.     PORT_DIPNAME( 0x80, 0x00, "Coin Type" )
  474.     PORT_DIPSETTING(    0x00, "Type 1" )
  475.     PORT_DIPSETTING(    0x80, "Type 2" )
  476.  
  477.     PORT_START  /* 401001 - Coins Etc. */
  478.     PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
  479.     PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
  480.     PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_START1 )
  481.     PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_START2 )
  482.  
  483.     PORT_START    /* 401003 - Player Controls */
  484.       PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )
  485.       PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 )
  486.       PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY )
  487.       PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY )
  488. INPUT_PORTS_END
  489.  
  490.  
  491.  
  492. static struct GfxLayout jumping_tilelayout =
  493. {
  494.     8,8,    /* 8*8 sprites */
  495.     16384,    /* 16384 sprites */
  496.     4,        /* 4 bits per pixel */
  497.     { 0, 0x20000*8, 0x40000*8, 0x60000*8 },
  498.     { 0, 1, 2, 3, 4, 5, 6, 7 },
  499.     { 0, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  500.     8*8        /* every sprite takes 8 consecutive bytes */
  501. };
  502.  
  503. static struct GfxLayout jumping_spritelayout =
  504. {
  505.     16,16,    /* 16*16 sprites */
  506.     5120,    /* 5120 sprites */
  507.     4,        /* 4 bits per pixel */
  508.     { 0x78000*8,0x50000*8,0x28000*8,0 },
  509.     { 0, 1, 2, 3, 4, 5, 6, 7, 8*16+0, 8*16+1, 8*16+2, 8*16+3, 8*16+4, 8*16+5, 8*16+6, 8*16+7 },
  510.     { 0, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
  511.     32*8    /* every sprite takes 32 consecutive bytes */
  512. };
  513.  
  514. static struct GfxDecodeInfo jumping_gfxdecodeinfo[] =
  515. {
  516.     { REGION_GFX1, 0, &jumping_tilelayout,   0, 0x80 },    /* sprites 8x8 */
  517.     { REGION_GFX2, 0, &jumping_spritelayout, 0, 0x80 },    /* sprites 16x16 */
  518.     { -1 }                                                 /* end of array */
  519. };
  520.  
  521.  
  522. static struct YM2203interface ym2203_interface =
  523. {
  524.     2,        /* 2 chips */
  525.     3579545,    /* ?? MHz */
  526.     { YM2203_VOL(30,30), YM2203_VOL(30,30) },
  527.     { 0 },
  528.     { 0 },
  529.     { 0 },
  530.     { 0 },
  531.     { 0 }
  532. };
  533.  
  534. static struct MachineDriver machine_driver_jumping =
  535. {
  536.     /* basic machine hardware */
  537.     {
  538.         {
  539.             CPU_M68000,
  540.             8000000,    /* 8 Mhz */
  541.             jumping_readmem,jumping_writemem,0,0,
  542.             rainbow_interrupt,1
  543.         },
  544.         {
  545.             CPU_Z80,
  546.             4000000,    /* 4 Mhz */
  547.             jumping_sound_readmem,jumping_sound_writemem,0,0,
  548.             ignore_interrupt,1
  549.         }
  550.     },
  551.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  552.     10,    /* 10 CPU slices per frame - enough ? */
  553.     0,
  554.  
  555.     /* video hardware */
  556.     40*8, 32*8, { 0*8, 40*8-1, 1*8, 31*8-1 },
  557.     jumping_gfxdecodeinfo,
  558.     2048, 2048,
  559.     0,
  560.  
  561.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
  562.     0,
  563.     rastan_vh_start,
  564.     rastan_vh_stop,
  565.     jumping_vh_screenrefresh,
  566.  
  567.     /* sound hardware */
  568.     0,0,0,0,
  569.     {
  570.         {
  571.             SOUND_YM2203,
  572.             &ym2203_interface
  573.         }
  574.     }
  575. };
  576.  
  577.  
  578.  
  579. ROM_START( rainbow )
  580.     ROM_REGION( 0x80000, REGION_CPU1 )             /* 8*64k for 68000 code */
  581.     ROM_LOAD_EVEN( "b22-10",     0x00000, 0x10000, 0x3b013495 )
  582.     ROM_LOAD_ODD ( "b22-11",     0x00000, 0x10000, 0x80041a3d )
  583.     ROM_LOAD_EVEN( "b22-08",     0x20000, 0x10000, 0x962fb845 )
  584.     ROM_LOAD_ODD ( "b22-09",     0x20000, 0x10000, 0xf43efa27 )
  585.     ROM_LOAD_EVEN( "ri_m03.rom", 0x40000, 0x20000, 0x3ebb0fb8 )
  586.     ROM_LOAD_ODD ( "ri_m04.rom", 0x40000, 0x20000, 0x91625e7f )
  587.  
  588.     ROM_REGION( 0x1c000, REGION_CPU2 )             /* 64k for the audio CPU */
  589.     ROM_LOAD( "b22-14",          0x00000, 0x4000, 0x113c1a5b )
  590.     ROM_CONTINUE(                0x10000, 0xc000 )
  591.  
  592.     ROM_REGION( 0x080000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  593.     ROM_LOAD( "ri_m01.rom",      0x000000, 0x80000, 0xb76c9168 )  /* 8x8 gfx */
  594.  
  595.     ROM_REGION( 0x0a0000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  596.       ROM_LOAD( "ri_m02.rom",      0x000000, 0x80000, 0x1b87ecf0 )  /* sprites */
  597.     ROM_LOAD( "b22-13",          0x080000, 0x10000, 0x2fda099f )
  598.     ROM_LOAD( "b22-12",          0x090000, 0x10000, 0x67a76dc6 )
  599.  
  600.     ROM_REGION( 0x10000, REGION_USER1 )             /* Dump of C-Chip */
  601.     ROM_LOAD( "jb1_f89",         0x0000, 0x10000, 0x0810d327 )
  602. ROM_END
  603.  
  604. ROM_START( rainbowe )
  605.     ROM_REGION( 0x80000, REGION_CPU1 )               /* 8*64k for 68000 code */
  606.     ROM_LOAD_EVEN( "ri_01.rom",    0x00000, 0x10000, 0x50690880 )
  607.     ROM_LOAD_ODD ( "ri_02.rom",    0x00000, 0x10000, 0x4dead71f )
  608.     ROM_LOAD_EVEN( "ri_03.rom",    0x20000, 0x10000, 0x4a4cb785 )
  609.     ROM_LOAD_ODD ( "ri_04.rom",    0x20000, 0x10000, 0x4caa53bd )
  610.     ROM_LOAD_EVEN( "ri_m03.rom",   0x40000, 0x20000, 0x3ebb0fb8 )
  611.     ROM_LOAD_ODD ( "ri_m04.rom",   0x40000, 0x20000, 0x91625e7f )
  612.  
  613.     ROM_REGION( 0x1c000, REGION_CPU2 )                /* 64k for the audio CPU */
  614.     ROM_LOAD( "b22-14",              0x00000, 0x4000, 0x113c1a5b )
  615.     ROM_CONTINUE(                    0x10000, 0xc000 )
  616.  
  617.     ROM_REGION( 0x080000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  618.     ROM_LOAD( "ri_m01.rom",           0x000000, 0x80000, 0xb76c9168 )        /* 8x8 gfx */
  619.  
  620.     ROM_REGION( 0x0a0000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  621.       ROM_LOAD( "ri_m02.rom",         0x000000, 0x80000, 0x1b87ecf0 )        /* sprites */
  622.     ROM_LOAD( "b22-13",             0x080000, 0x10000, 0x2fda099f )
  623.     ROM_LOAD( "b22-12",             0x090000, 0x10000, 0x67a76dc6 )
  624.  
  625.     /* C-Chip is missing! */
  626. ROM_END
  627.  
  628. ROM_START( jumping )
  629.     ROM_REGION( 0xA0000, REGION_CPU1 )        /* 8*64k for code, 64k*2 for protection chip */
  630.     ROM_LOAD_EVEN( "jb1_h4",       0x00000, 0x10000, 0x3fab6b31 )
  631.     ROM_LOAD_ODD ( "jb1_h8",       0x00000, 0x10000, 0x8c878827 )
  632.     ROM_LOAD_EVEN( "jb1_i4",       0x20000, 0x10000, 0x443492cf )
  633.     ROM_LOAD_ODD ( "jb1_i8",       0x20000, 0x10000, 0xed33bae1 )
  634.     ROM_LOAD_EVEN( "ri_m03.rom",   0x40000, 0x20000, 0x3ebb0fb8 )
  635.     ROM_LOAD_ODD ( "ri_m04.rom",   0x40000, 0x20000, 0x91625e7f )
  636.     ROM_LOAD_ODD ( "jb1_f89",      0x80000, 0x10000, 0x0810d327 )     /* Dump of C-Chip? */
  637.  
  638.     ROM_REGION( 0x14000, REGION_CPU2 )        /* 64k for the audio CPU */
  639.     ROM_LOAD( "jb1_cd67",      0x00000, 0x8000, 0x8527c00e )
  640.     ROM_CONTINUE(              0x10000, 0x4000 )
  641.     ROM_CONTINUE(              0x0c000, 0x4000 )
  642.  
  643.  
  644.     ROM_REGION( 0x080000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  645.     ROM_LOAD( "jb2_ic8",           0x00000, 0x10000, 0x65b76309 )            /* 8x8 characters */
  646.     ROM_LOAD( "jb2_ic7",           0x10000, 0x10000, 0x43a94283 )
  647.     ROM_LOAD( "jb2_ic10",          0x20000, 0x10000, 0xe61933fb )
  648.     ROM_LOAD( "jb2_ic9",           0x30000, 0x10000, 0xed031eb2 )
  649.     ROM_LOAD( "jb2_ic12",          0x40000, 0x10000, 0x312700ca )
  650.     ROM_LOAD( "jb2_ic11",          0x50000, 0x10000, 0xde3b0b88 )
  651.     ROM_LOAD( "jb2_ic14",          0x60000, 0x10000, 0x9fdc6c8e )
  652.     ROM_LOAD( "jb2_ic13",          0x70000, 0x10000, 0x06226492 )
  653.  
  654.     ROM_REGION( 0x0a0000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  655.     ROM_LOAD( "jb2_ic62",          0x00000, 0x10000, 0x8548db6c )            /* 16x16 sprites */
  656.     ROM_LOAD( "jb2_ic61",          0x10000, 0x10000, 0x37c5923b )
  657.     ROM_LOAD( "jb2_ic60",          0x20000, 0x08000, 0x662a2f1e )
  658.     ROM_LOAD( "jb2_ic78",          0x28000, 0x10000, 0x925865e1 )
  659.     ROM_LOAD( "jb2_ic77",          0x38000, 0x10000, 0xb09695d1 )
  660.     ROM_LOAD( "jb2_ic76",          0x48000, 0x08000, 0x41937743 )
  661.     ROM_LOAD( "jb2_ic93",          0x50000, 0x10000, 0xf644eeab )
  662.     ROM_LOAD( "jb2_ic92",          0x60000, 0x10000, 0x3fbccd33 )
  663.     ROM_LOAD( "jb2_ic91",          0x70000, 0x08000, 0xd886c014 )
  664.     ROM_LOAD( "jb2_i121",          0x78000, 0x10000, 0x93df1e4d )
  665.     ROM_LOAD( "jb2_i120",          0x88000, 0x10000, 0x7c4e893b )
  666.     ROM_LOAD( "jb2_i119",          0x98000, 0x08000, 0x7e1d58d8 )
  667. ROM_END
  668.  
  669.  
  670.  
  671. /* sprite roms need all bits reversing, as colours are    */
  672. /* mapped back to front from the pattern used by Rainbow! */
  673. static void init_jumping(void)
  674. {
  675.     /* Sprite colour map is reversed - switch to normal */
  676.     int i;
  677.  
  678.     for (i = 0;i < memory_region_length(REGION_GFX2);i++)
  679.             memory_region(REGION_GFX2)[i] ^= 0xff;
  680. }
  681.  
  682.  
  683.  
  684. GAME( 1987, rainbow,  0,       rainbow, rainbow, 0,       ROT0, "Taito Corporation", "Rainbow Islands" )
  685. GAMEX(1988, rainbowe, rainbow, rainbow, rainbow, 0,       ROT0, "Taito Corporation", "Rainbow Islands (Extra)", GAME_NOT_WORKING )
  686. GAME( 1989, jumping,  rainbow, jumping, jumping, jumping, ROT0, "bootleg", "Jumping" )
  687.